Revert addition of a number of Config params
authorAlex Crichton <alex@alexcrichton.com>
Fri, 7 Oct 2016 18:07:37 +0000 (11:07 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Fri, 7 Oct 2016 18:09:49 +0000 (11:09 -0700)
22 files changed:
src/cargo/core/package.rs
src/cargo/core/registry.rs
src/cargo/core/resolver/mod.rs
src/cargo/core/source.rs
src/cargo/ops/cargo_clean.rs
src/cargo/ops/cargo_compile.rs
src/cargo/ops/cargo_fetch.rs
src/cargo/ops/cargo_install.rs
src/cargo/ops/cargo_output_metadata.rs
src/cargo/ops/cargo_rustc/context.rs
src/cargo/ops/cargo_rustc/custom_build.rs
src/cargo/ops/cargo_rustc/fingerprint.rs
src/cargo/ops/cargo_rustc/job_queue.rs
src/cargo/ops/cargo_rustc/mod.rs
src/cargo/ops/resolve.rs
src/cargo/sources/directory.rs
src/cargo/sources/git/source.rs
src/cargo/sources/path.rs
src/cargo/sources/registry/index.rs
src/cargo/sources/registry/mod.rs
src/cargo/sources/replaced.rs
tests/resolve.rs

index 0235b619285f1ca024edbef5b6c8e88a82322cbc..da14b04fc33c6d36b0328b3cfad981a337348770 100644 (file)
@@ -156,7 +156,7 @@ impl<'cfg> PackageSet<'cfg> {
         Box::new(self.packages.iter().map(|&(ref p, _)| p))
     }
 
-    pub fn get(&self, id: &PackageId, config: &Config) -> CargoResult<&Package> {
+    pub fn get(&self, id: &PackageId) -> CargoResult<&Package> {
         let slot = try!(self.packages.iter().find(|p| p.0 == *id).chain_error(|| {
             internal(format!("couldn't find `{}` in package set", id))
         }));
@@ -168,7 +168,7 @@ impl<'cfg> PackageSet<'cfg> {
         let source = try!(sources.get_mut(id.source_id()).chain_error(|| {
             internal(format!("couldn't find source for `{}`", id))
         }));
-        let pkg = try!(source.download(id, config).chain_error(|| {
+        let pkg = try!(source.download(id).chain_error(|| {
             human("unable to get packages from source")
         }));
         assert!(slot.fill(pkg).is_ok());
index 5aa11abfda7818f2cc980204710e59e609e2e67b..bea9e6a1041f38ef5eb194c0cc84c73649e307d3 100644 (file)
@@ -10,7 +10,7 @@ use sources::config::SourceConfigMap;
 /// See also `core::Source`.
 pub trait Registry {
     /// Attempt to find the packages that match a dependency request.
-    fn query(&mut self, name: &Dependency, config: &Config) -> CargoResult<Vec<Summary>>;
+    fn query(&mut self, name: &Dependency) -> CargoResult<Vec<Summary>>;
 
     /// Returns whether or not this registry will return summaries with
     /// checksums listed.
@@ -22,22 +22,22 @@ pub trait Registry {
 }
 
 impl Registry for Vec<Summary> {
-    fn query(&mut self, dep: &Dependency, _config: &Config) -> CargoResult<Vec<Summary>> {
+    fn query(&mut self, dep: &Dependency) -> CargoResult<Vec<Summary>> {
         Ok(self.iter().filter(|summary| dep.matches(*summary))
                .cloned().collect())
     }
 }
 
 impl Registry for Vec<Package> {
-    fn query(&mut self, dep: &Dependency, _config: &Config) -> CargoResult<Vec<Summary>> {
+    fn query(&mut self, dep: &Dependency) -> CargoResult<Vec<Summary>> {
         Ok(self.iter().filter(|pkg| dep.matches(pkg.summary()))
                .map(|pkg| pkg.summary().clone()).collect())
     }
 }
 
 impl<'a, T: ?Sized + Registry + 'a> Registry for Box<T> {
-    fn query(&mut self, name: &Dependency, config: &Config) -> CargoResult<Vec<Summary>> {
-        (**self).query(name, config)
+    fn query(&mut self, name: &Dependency) -> CargoResult<Vec<Summary>> {
+        (**self).query(name)
     }
 }
 
index ed57a1a9b0bed809248fb6649080b13d3a64de8f..7a9e953365a6283e73f375b154add2d1efd195f6 100644 (file)
@@ -55,7 +55,7 @@ use semver;
 
 use core::{PackageId, Registry, SourceId, Summary, Dependency};
 use core::PackageIdSpec;
-use util::{CargoResult, Graph, human, CargoError, Config};
+use util::{CargoResult, Graph, human, CargoError};
 use util::profile;
 use util::ChainError;
 use util::graph::{Nodes, Edges};
@@ -265,8 +265,7 @@ struct Context<'a> {
 /// Builds the list of all packages required to build the first argument.
 pub fn resolve(summaries: &[(Summary, Method)],
                replacements: &[(PackageIdSpec, Dependency)],
-               registry: &mut Registry,
-               config: &Config) -> CargoResult<Resolve> {
+               registry: &mut Registry) -> CargoResult<Resolve> {
     let cx = Context {
         resolve_graph: Graph::new(),
         resolve_features: HashMap::new(),
@@ -275,7 +274,7 @@ pub fn resolve(summaries: &[(Summary, Method)],
         replacements: replacements,
     };
     let _p = profile::start(format!("resolving"));
-    let cx = try!(activate_deps_loop(cx, registry, summaries, config));
+    let cx = try!(activate_deps_loop(cx, registry, summaries));
 
     let mut resolve = Resolve {
         graph: cx.resolve_graph,
@@ -306,8 +305,7 @@ fn activate(cx: &mut Context,
             registry: &mut Registry,
             parent: Option<&Rc<Summary>>,
             candidate: Candidate,
-            method: &Method,
-            config: &Config)
+            method: &Method)
             -> CargoResult<Option<DepsFrame>> {
     if let Some(parent) = parent {
         cx.resolve_graph.link(parent.package_id().clone(),
@@ -335,7 +333,7 @@ fn activate(cx: &mut Context,
         }
     };
 
-    let deps = try!(cx.build_deps(registry, &candidate, method, config));
+    let deps = try!(cx.build_deps(registry, &candidate, method));
 
     Ok(Some(DepsFrame {
         parent: candidate,
@@ -437,8 +435,7 @@ struct BacktrackFrame<'a> {
 /// dependency graph, cx.resolve is returned.
 fn activate_deps_loop<'a>(mut cx: Context<'a>,
                           registry: &mut Registry,
-                          summaries: &[(Summary, Method)],
-                          config: &Config)
+                          summaries: &[(Summary, Method)])
                           -> CargoResult<Context<'a>> {
     // Note that a `BinaryHeap` is used for the remaining dependencies that need
     // activation. This heap is sorted such that the "largest value" is the most
@@ -454,7 +451,7 @@ fn activate_deps_loop<'a>(mut cx: Context<'a>,
         let summary = Rc::new(summary.clone());
         let candidate = Candidate { summary: summary, replace: None };
         remaining_deps.extend(try!(activate(&mut cx, registry, None, candidate,
-                                            method, config)));
+                                            method)));
     }
 
     // Main resolution loop, this is the workhorse of the resolution algorithm.
@@ -548,8 +545,7 @@ fn activate_deps_loop<'a>(mut cx: Context<'a>,
                     None => return Err(activation_error(&cx, registry, &parent,
                                                         &dep,
                                                         &cx.prev_active(&dep),
-                                                        &candidates,
-                                                        config)),
+                                                        &candidates)),
                     Some(candidate) => candidate,
                 }
             }
@@ -563,7 +559,7 @@ fn activate_deps_loop<'a>(mut cx: Context<'a>,
         trace!("{}[{}]>{} trying {}", parent.name(), cur, dep.name(),
                candidate.summary.version());
         remaining_deps.extend(try!(activate(&mut cx, registry, Some(&parent),
-                                            candidate, &method, config)));
+                                            candidate, &method)));
     }
 
     Ok(cx)
@@ -599,8 +595,7 @@ fn activation_error(cx: &Context,
                     parent: &Summary,
                     dep: &Dependency,
                     prev_active: &[Rc<Summary>],
-                    candidates: &[Candidate],
-                    config: &Config) -> Box<CargoError> {
+                    candidates: &[Candidate]) -> Box<CargoError> {
     if candidates.len() > 0 {
         let mut msg = format!("failed to select a version for `{}` \
                                (required by `{}`):\n\
@@ -653,7 +648,7 @@ fn activation_error(cx: &Context,
     let mut msg = msg;
     let all_req = semver::VersionReq::parse("*").unwrap();
     let new_dep = dep.clone_inner().set_version_req(all_req).into_dependency();
-    let mut candidates = match registry.query(&new_dep, config) {
+    let mut candidates = match registry.query(&new_dep) {
         Ok(candidates) => candidates,
         Err(e) => return e,
     };
@@ -821,8 +816,7 @@ impl<'a> Context<'a> {
     fn build_deps(&mut self,
                   registry: &mut Registry,
                   candidate: &Summary,
-                  method: &Method,
-                  config: &Config) -> CargoResult<Vec<DepInfo>> {
+                  method: &Method) -> CargoResult<Vec<DepInfo>> {
         // First, figure out our set of dependencies based on the requsted set
         // of features. This also calculates what features we're going to enable
         // for our own dependencies.
@@ -831,7 +825,7 @@ impl<'a> Context<'a> {
         // Next, transform all dependencies into a list of possible candidates
         // which can satisfy that dependency.
         let mut deps = try!(deps.into_iter().map(|(dep, features)| {
-            let mut candidates = try!(self.query(registry, &dep, config));
+            let mut candidates = try!(self.query(registry, &dep));
             // When we attempt versions for a package, we'll want to start at
             // the maximum version and work our way down.
             candidates.sort_by(|a, b| {
@@ -857,9 +851,8 @@ impl<'a> Context<'a> {
     /// return.
     fn query(&self,
              registry: &mut Registry,
-             dep: &Dependency,
-             config: &Config) -> CargoResult<Vec<Candidate>> {
-        let summaries = try!(registry.query(dep, config));
+             dep: &Dependency) -> CargoResult<Vec<Candidate>> {
+        let summaries = try!(registry.query(dep));
         summaries.into_iter().map(Rc::new).map(|summary| {
             // get around lack of non-lexical lifetimes
             let summary2 = summary.clone();
@@ -872,7 +865,7 @@ impl<'a> Context<'a> {
                 Some(replacement) => replacement,
             };
 
-            let mut summaries = try!(registry.query(dep, config)).into_iter();
+            let mut summaries = try!(registry.query(dep)).into_iter();
             let s = try!(summaries.next().chain_error(|| {
                 human(format!("no matching package for override `{}` found\n\
                                location searched: {}\n\
index b09d57ef93efee0849c3a3da8bf710f3a615b7e7..4a46c19294d26677af0d5842604bf1a935caf069 100644 (file)
@@ -27,7 +27,7 @@ pub trait Source: Registry {
 
     /// The download method fetches the full package for each name and
     /// version specified.
-    fn download(&mut self, package: &PackageId, config: &Config) -> CargoResult<Package>;
+    fn download(&mut self, package: &PackageId) -> CargoResult<Package>;
 
     /// Generates a unique string which represents the fingerprint of the
     /// current state of the source.
@@ -57,8 +57,8 @@ impl<'a, T: Source + ?Sized + 'a> Source for Box<T> {
         (**self).update()
     }
 
-    fn download(&mut self, id: &PackageId, config: &Config) -> CargoResult<Package> {
-        (**self).download(id, config)
+    fn download(&mut self, id: &PackageId) -> CargoResult<Package> {
+        (**self).download(id)
     }
 
     fn fingerprint(&self, pkg: &Package) -> CargoResult<String> {
index c5a32e1d6349c6832367615bbf6658dc740b1f3d..e19b37f116fc20ecd09930d532adc9b6382c15e5 100644 (file)
@@ -47,7 +47,7 @@ pub fn clean(ws: &Workspace, opts: &CleanOptions) -> CargoResult<()> {
     for spec in opts.spec {
         // Translate the spec to a Package
         let pkgid = try!(resolve.query(spec));
-        let pkg = try!(packages.get(&pkgid, ws.config()));
+        let pkg = try!(packages.get(&pkgid));
 
         // Generate all relevant `Unit` targets for this package
         for target in pkg.targets() {
index 44ea51afdd572fb118dcaf68f403c92444f8194c..0767e9e467aafd96f912825cebc711b8065067c1 100644 (file)
@@ -190,7 +190,7 @@ pub fn compile_ws<'a>(ws: &Workspace<'a>,
     };
 
     let to_builds = try!(pkgids.iter().map(|id| {
-        packages.get(id, config)
+        packages.get(id)
     }).collect::<CargoResult<Vec<_>>>());
 
     let mut general_targets = Vec::new();
index 43cd5c109a98dd9fd3d5b6953abbdd83d7a679f7..a0144c8f4729c3f2758821bbdc30d6bf0ffd37da 100644 (file)
@@ -9,7 +9,7 @@ pub fn fetch<'a>(ws: &Workspace<'a>) -> CargoResult<(Resolve, PackageSet<'a>)> {
     let resolve = try!(ops::resolve_ws(&mut registry, ws));
     let packages = get_resolved_packages(&resolve, registry);
     for id in resolve.iter() {
-        try!(packages.get(id, ws.config()));
+        try!(packages.get(id));
     }
     Ok((resolve, packages))
 }
index 91d44a4d4ffe55d076ca681c90bbd8e367ce35a2..59d16e272867e837961be2423072ec0bb9903be3 100644 (file)
@@ -260,10 +260,10 @@ fn select_pkg<'a, T>(mut source: T,
     match name {
         Some(name) => {
             let dep = try!(Dependency::parse(name, vers, source_id, config));
-            let deps = try!(source.query(&dep, config));
+            let deps = try!(source.query(&dep));
             match deps.iter().map(|p| p.package_id()).max() {
                 Some(pkgid) => {
-                    let pkg = try!(source.download(pkgid, config));
+                    let pkg = try!(source.download(pkgid));
                     Ok((pkg, Box::new(source)))
                 }
                 None => {
index 488fa9853a148d16553121e438f670ad128a346e..131b93825db8c414eed214de6c79f4f70b20f60e 100644 (file)
@@ -52,7 +52,7 @@ fn metadata_full(ws: &Workspace,
     let (packages, resolve) = deps;
 
     let packages = try!(packages.package_ids()
-                                .map(|i| packages.get(i, ws.config()).map(|p| p.clone()))
+                                .map(|i| packages.get(i).map(|p| p.clone()))
                                 .collect());
 
     Ok(ExportInfo {
index 5ff2a6c8fee202a4a4aae9d05168fe0501cece2f..7cbd2149fe4671d175042933d371bbf2a0e47ddf 100644 (file)
@@ -156,7 +156,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
                 }
             }));
         }
-        for dep in try!(self.dep_targets(&unit, self.config)) {
+        for dep in try!(self.dep_targets(&unit)) {
             try!(self.visit_crate_type(&dep, crate_types));
         }
         Ok(())
@@ -251,8 +251,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
         for unit in units {
             try!(self.walk_used_in_plugin_map(unit,
                                               unit.target.for_host(),
-                                              &mut visited,
-                                              self.config));
+                                              &mut visited));
         }
         Ok(())
     }
@@ -260,8 +259,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
     fn walk_used_in_plugin_map(&mut self,
                                unit: &Unit<'a>,
                                is_plugin: bool,
-                               visited: &mut HashSet<(Unit<'a>, bool)>,
-                               config: &Config)
+                               visited: &mut HashSet<(Unit<'a>, bool)>)
                                -> CargoResult<()> {
         if !visited.insert((*unit, is_plugin)) {
             return Ok(())
@@ -269,11 +267,10 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
         if is_plugin {
             self.used_in_plugin.insert(*unit);
         }
-        for unit in try!(self.dep_targets(unit, config)) {
+        for unit in try!(self.dep_targets(unit)) {
             try!(self.walk_used_in_plugin_map(&unit,
                                               is_plugin || unit.target.for_host(),
-                                              visited,
-                                              config));
+                                              visited));
         }
         Ok(())
     }
@@ -446,11 +443,11 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
 
     /// For a package, return all targets which are registered as dependencies
     /// for that package.
-    pub fn dep_targets(&self, unit: &Unit<'a>, config: &Config) -> CargoResult<Vec<Unit<'a>>> {
+    pub fn dep_targets(&self, unit: &Unit<'a>) -> CargoResult<Vec<Unit<'a>>> {
         if unit.profile.run_custom_build {
             return self.dep_run_custom_build(unit)
         } else if unit.profile.doc {
-            return self.doc_deps(unit, config);
+            return self.doc_deps(unit);
         }
 
         let id = unit.pkg.package_id();
@@ -493,7 +490,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
                 true
             })
         }).filter_map(|id| {
-            match self.get_package(id, config) {
+            match self.get_package(id) {
                 Ok(pkg) => {
                     pkg.targets().iter().find(|t| t.is_lib()).map(|t| {
                         Ok(Unit {
@@ -567,7 +564,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
             profile: &self.profiles.dev,
             ..*unit
         };
-        let deps = try!(self.dep_targets(&tmp, self.config));
+        let deps = try!(self.dep_targets(&tmp));
         Ok(deps.iter().filter_map(|unit| {
             if !unit.target.linkable() || unit.pkg.manifest().links().is_none() {
                 return None
@@ -581,7 +578,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
     }
 
     /// Returns the dependencies necessary to document a package
-    fn doc_deps(&self, unit: &Unit<'a>, config: &Config) -> CargoResult<Vec<Unit<'a>>> {
+    fn doc_deps(&self, unit: &Unit<'a>) -> CargoResult<Vec<Unit<'a>>> {
         let deps = self.resolve.deps(unit.pkg.package_id()).filter(|dep| {
             unit.pkg.dependencies().iter().filter(|d| {
                 d.name() == dep.name()
@@ -593,7 +590,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
                 }
             })
         }).map(|dep| {
-            self.get_package(dep, config)
+            self.get_package(dep)
         });
 
         // To document a library, we depend on dependencies actually being
@@ -676,8 +673,8 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
     }
 
     /// Gets a package for the given package id.
-    pub fn get_package(&self, id: &PackageId, config: &Config) -> CargoResult<&'a Package> {
-        self.packages.get(id, config)
+    pub fn get_package(&self, id: &PackageId) -> CargoResult<&'a Package> {
+        self.packages.get(id)
     }
 
     /// Get the user-specified linker for a particular host or target
index c78d067d6181c1bf698d5698f6ccece6f4a1abec..5a15e85a853af264e18350ffc4e99cd78e95f31e 100644 (file)
@@ -413,7 +413,7 @@ pub fn build_map<'b, 'cfg>(cx: &mut Context<'b, 'cfg>,
         if !unit.target.is_custom_build() && unit.pkg.has_custom_build() {
             add_to_link(&mut ret, unit.pkg.package_id(), unit.kind);
         }
-        for unit in try!(cx.dep_targets(unit, cx.config)).iter() {
+        for unit in try!(cx.dep_targets(unit)).iter() {
             let dep_scripts = try!(build(out, cx, unit));
 
             if unit.target.for_host() {
index a24d7ad2b6d05137ade58891b1a52662e8a46504..702deb5f863c5c5f900c548f484f0027e344c510 100644 (file)
@@ -345,7 +345,7 @@ fn calculate<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>)
     // elsewhere. Also skip fingerprints of binaries because they don't actually
     // induce a recompile, they're just dependencies in the sense that they need
     // to be built.
-    let deps = try!(cx.dep_targets(unit, cx.config));
+    let deps = try!(cx.dep_targets(unit));
     let deps = try!(deps.iter().filter(|u| {
         !u.target.is_custom_build() && !u.target.is_bin()
     }).map(|unit| {
index db359a7345a1212f955cf3288bf53fa17d2cea94..53bad6b786c602e7a11cfbf904bcf63061eceed4 100644 (file)
@@ -323,12 +323,12 @@ impl<'a> Key<'a> {
     fn dependencies<'cfg>(&self, cx: &Context<'a, 'cfg>)
                           -> CargoResult<Vec<Key<'a>>> {
         let unit = Unit {
-            pkg: try!(cx.get_package(self.pkg, cx.config)),
+            pkg: try!(cx.get_package(self.pkg)),
             target: self.target,
             profile: self.profile,
             kind: self.kind,
         };
-        let targets = try!(cx.dep_targets(&unit, cx.config));
+        let targets = try!(cx.dep_targets(&unit));
         Ok(targets.iter().filter_map(|unit| {
             // Binaries aren't actually needed to *compile* tests, just to run
             // them, so we don't include this dependency edge in the job graph.
index 660f517ca8f2b3a0b572ff26b8085eb03f51b672..280b6c05df5fcf0b58a704e51f14ab068f416c49 100644 (file)
@@ -130,7 +130,7 @@ pub fn compile_targets<'a, 'cfg: 'a>(ws: &Workspace<'cfg>,
             if !unit.target.is_lib() { continue }
 
             // Include immediate lib deps as well
-            for unit in try!(cx.dep_targets(unit, cx.config)).iter() {
+            for unit in try!(cx.dep_targets(unit)).iter() {
                 let pkgid = unit.pkg.package_id();
                 if !unit.target.is_lib() { continue }
                 if unit.profile.doc { continue }
@@ -197,7 +197,7 @@ fn compile<'a, 'cfg: 'a>(cx: &mut Context<'a, 'cfg>,
     drop(p);
 
     // Be sure to compile all dependencies of this target as well.
-    for unit in try!(cx.dep_targets(unit, cx.config)).iter() {
+    for unit in try!(cx.dep_targets(unit)).iter() {
         try!(compile(cx, jobs, unit));
     }
     Ok(())
@@ -652,7 +652,7 @@ fn build_deps_args(cmd: &mut CommandPrototype, cx: &Context, unit: &Unit)
         cmd.env("OUT_DIR", &layout.build_out(unit.pkg));
     }
 
-    for unit in try!(cx.dep_targets(unit, cx.config)).iter() {
+    for unit in try!(cx.dep_targets(unit)).iter() {
         if unit.target.linkable() && !unit.profile.doc {
             try!(link_to(cmd, cx, unit));
         }
index 6b114dd61ccea05811aa73d8183e690b78acee97..af912b0dfba15ae6fab61a4c50a58fbced1dbb94 100644 (file)
@@ -127,7 +127,7 @@ pub fn resolve_with_previous<'a>(registry: &mut PackageRegistry,
         None => root_replace.to_vec(),
     };
 
-    let mut resolved = try!(resolver::resolve(&summaries, &replace, registry, ws.config()));
+    let mut resolved = try!(resolver::resolve(&summaries, &replace, registry));
     if let Some(previous) = previous {
         try!(resolved.merge_from(previous));
     }
index 650a5092413693fa40d94c8c7db8cbfae35cffdd..84a9501a03b59c8d4c7abb176337b6e412b9f291 100644 (file)
@@ -44,7 +44,7 @@ impl<'cfg> Debug for DirectorySource<'cfg> {
 }
 
 impl<'cfg> Registry for DirectorySource<'cfg> {
-    fn query(&mut self, dep: &Dependency, _config: &Config) -> CargoResult<Vec<Summary>> {
+    fn query(&mut self, dep: &Dependency) -> CargoResult<Vec<Summary>> {
         let packages = self.packages.values().map(|p| &p.0);
         let matches = packages.filter(|pkg| dep.matches(pkg.summary()));
         let summaries = matches.map(|pkg| pkg.summary().clone());
@@ -98,7 +98,7 @@ impl<'cfg> Source for DirectorySource<'cfg> {
         Ok(())
     }
 
-    fn download(&mut self, id: &PackageId, _config: &Config) -> CargoResult<Package> {
+    fn download(&mut self, id: &PackageId) -> CargoResult<Package> {
         self.packages.get(id).map(|p| &p.0).cloned().chain_error(|| {
             human(format!("failed to find package with id: {}", id))
         })
index 87e424810a922a104e124c5116a6694b2ea4ddf9..eeffcb05b724d7e5a7044729c3f6848c4d52aa3f 100644 (file)
@@ -114,10 +114,10 @@ impl<'cfg> Debug for GitSource<'cfg> {
 }
 
 impl<'cfg> Registry for GitSource<'cfg> {
-    fn query(&mut self, dep: &Dependency, config: &Config) -> CargoResult<Vec<Summary>> {
+    fn query(&mut self, dep: &Dependency) -> CargoResult<Vec<Summary>> {
         let src = self.path_source.as_mut()
                       .expect("BUG: update() must be called before query()");
-        src.query(dep, config)
+        src.query(dep)
     }
 }
 
@@ -175,12 +175,12 @@ impl<'cfg> Source for GitSource<'cfg> {
         self.path_source.as_mut().unwrap().update()
     }
 
-    fn download(&mut self, id: &PackageId, config: &Config) -> CargoResult<Package> {
+    fn download(&mut self, id: &PackageId) -> CargoResult<Package> {
         trace!("getting packages for package id `{}` from `{:?}`", id,
                self.remote);
         self.path_source.as_mut()
                         .expect("BUG: update() must be called before get()")
-                        .download(id, config)
+                        .download(id)
     }
 
     fn fingerprint(&self, _pkg: &Package) -> CargoResult<String> {
index cee7f6cf3f10d8e9b4751c6fc166b846c815af04..052d01c7dab0c755efe172975f6c0d6e5c3ef875 100644 (file)
@@ -310,8 +310,8 @@ impl<'cfg> Debug for PathSource<'cfg> {
 }
 
 impl<'cfg> Registry for PathSource<'cfg> {
-    fn query(&mut self, dep: &Dependency, config: &Config) -> CargoResult<Vec<Summary>> {
-        self.packages.query(dep, config)
+    fn query(&mut self, dep: &Dependency) -> CargoResult<Vec<Summary>> {
+        self.packages.query(dep)
     }
 }
 
@@ -326,7 +326,7 @@ impl<'cfg> Source for PathSource<'cfg> {
         Ok(())
     }
 
-    fn download(&mut self, id: &PackageId, _config: &Config) -> CargoResult<Package> {
+    fn download(&mut self, id: &PackageId) -> CargoResult<Package> {
         trace!("getting packages; id={}", id);
 
         let pkg = self.packages.iter().find(|pkg| pkg.package_id() == id);
index 9d50b4f75bbd3417c5697f7a5db7c861bf11c003..e7bd2b872234951e347a03a4d1114839f51344a9 100644 (file)
@@ -35,13 +35,13 @@ impl<'cfg> RegistryIndex<'cfg> {
     }
 
     /// Return the hash listed for a specified PackageId.
-    pub fn hash(&mut self, pkg: &PackageId, config: &Config) -> CargoResult<String> {
+    pub fn hash(&mut self, pkg: &PackageId) -> CargoResult<String> {
         let key = (pkg.name().to_string(), pkg.version().to_string());
         if let Some(s) = self.hashes.get(&key) {
             return Ok(s.clone())
         }
         // Ok, we're missing the key, so parse the index file to load it.
-        try!(self.summaries(pkg.name(), config));
+        try!(self.summaries(pkg.name()));
         self.hashes.get(&key).chain_error(|| {
             internal(format!("no hash listed for {}", pkg))
         }).map(|s| s.clone())
@@ -51,11 +51,11 @@ impl<'cfg> RegistryIndex<'cfg> {
     ///
     /// Returns a list of pairs of (summary, yanked) for the package name
     /// specified.
-    pub fn summaries(&mut self, name: &str, config: &Config) -> CargoResult<&Vec<(Summary, bool)>> {
+    pub fn summaries(&mut self, name: &str) -> CargoResult<&Vec<(Summary, bool)>> {
         if self.cache.contains_key(name) {
             return Ok(self.cache.get(name).unwrap());
         }
-        let summaries = try!(self.load_summaries(name, config));
+        let summaries = try!(self.load_summaries(name));
         let summaries = summaries.into_iter().filter(|summary| {
             summary.0.package_id().name() == name
         }).collect();
@@ -63,7 +63,7 @@ impl<'cfg> RegistryIndex<'cfg> {
         Ok(self.cache.get(name).unwrap())
     }
 
-    fn load_summaries(&mut self, name: &str, config: &Config) -> CargoResult<Vec<(Summary, bool)>> {
+    fn load_summaries(&mut self, name: &str) -> CargoResult<Vec<(Summary, bool)>> {
         let (path, _lock) = if self.locked {
             let lock = self.path.open_ro(Path::new(INDEX_LOCK),
                                          self.config,
@@ -97,7 +97,7 @@ impl<'cfg> RegistryIndex<'cfg> {
                 try!(f.read_to_string(&mut contents));
                 let ret: CargoResult<Vec<(Summary, bool)>>;
                 ret = contents.lines().filter(|l| l.trim().len() > 0)
-                              .map(|l| self.parse_registry_package(l, config))
+                              .map(|l| self.parse_registry_package(l))
                               .collect();
                 ret.chain_error(|| {
                     internal(format!("failed to parse registry's information \
@@ -112,14 +112,14 @@ impl<'cfg> RegistryIndex<'cfg> {
     /// package.
     ///
     /// The returned boolean is whether or not the summary has been yanked.
-    fn parse_registry_package(&mut self, line: &str, config: &Config)
+    fn parse_registry_package(&mut self, line: &str)
                               -> CargoResult<(Summary, bool)> {
         let RegistryPackage {
             name, vers, cksum, deps, features, yanked
         } = try!(json::decode::<RegistryPackage>(line));
         let pkgid = try!(PackageId::new(&name, &vers, &self.source_id));
         let deps: CargoResult<Vec<Dependency>> = deps.into_iter().map(|dep| {
-            self.parse_registry_dependency(dep, config)
+            self.parse_registry_dependency(dep)
         }).collect();
         let deps = try!(deps);
         let summary = try!(Summary::new(pkgid, deps, features));
@@ -129,14 +129,15 @@ impl<'cfg> RegistryIndex<'cfg> {
     }
 
     /// Converts an encoded dependency in the registry to a cargo dependency
-    fn parse_registry_dependency(&self, dep: RegistryDependency, config: &Config)
+    fn parse_registry_dependency(&self, dep: RegistryDependency)
                                  -> CargoResult<Dependency> {
         let RegistryDependency {
             name, req, features, optional, default_features, target, kind
         } = dep;
 
         let dep = try!(DependencyInner::parse(&name, Some(&req),
-                                              &self.source_id, config));
+                                              &self.source_id,
+                                              self.config));
         let kind = match kind.as_ref().map(|s| &s[..]).unwrap_or("") {
             "dev" => Kind::Development,
             "build" => Kind::Build,
@@ -165,9 +166,9 @@ impl<'cfg> RegistryIndex<'cfg> {
 }
 
 impl<'cfg> Registry for RegistryIndex<'cfg> {
-    fn query(&mut self, dep: &Dependency, config: &Config) -> CargoResult<Vec<Summary>> {
+    fn query(&mut self, dep: &Dependency) -> CargoResult<Vec<Summary>> {
         let mut summaries = {
-            let summaries = try!(self.summaries(dep.name(), config));
+            let summaries = try!(self.summaries(dep.name()));
             summaries.iter().filter(|&&(_, yanked)| {
                 dep.source_id().precise().is_some() || !yanked
             }).map(|s| s.0.clone()).collect::<Vec<_>>()
@@ -187,7 +188,7 @@ impl<'cfg> Registry for RegistryIndex<'cfg> {
                 _ => true,
             }
         });
-        summaries.query(dep, config)
+        summaries.query(dep)
     }
 
     fn supports_checksums(&self) -> bool {
index 2b959b163f267a7a617f3f929d9d1741e6f12db6..3a1babafb040de2502269a12055f6aabce4eb296 100644 (file)
@@ -317,18 +317,18 @@ impl<'cfg> RegistrySource<'cfg> {
 }
 
 impl<'cfg> Registry for RegistrySource<'cfg> {
-    fn query(&mut self, dep: &Dependency, config: &Config) -> CargoResult<Vec<Summary>> {
+    fn query(&mut self, dep: &Dependency) -> CargoResult<Vec<Summary>> {
         // If this is a precise dependency, then it came from a lockfile and in
         // theory the registry is known to contain this version. If, however, we
         // come back with no summaries, then our registry may need to be
         // updated, so we fall back to performing a lazy update.
         if dep.source_id().precise().is_some() && !self.updated {
-            if try!(self.index.query(dep, config)).is_empty() {
+            if try!(self.index.query(dep)).is_empty() {
                 try!(self.do_update());
             }
         }
 
-        self.index.query(dep, config)
+        self.index.query(dep)
     }
 
     fn supports_checksums(&self) -> bool {
@@ -351,15 +351,15 @@ impl<'cfg> Source for RegistrySource<'cfg> {
         Ok(())
     }
 
-    fn download(&mut self, package: &PackageId, config: &Config) -> CargoResult<Package> {
-        let hash = try!(self.index.hash(package, config));
+    fn download(&mut self, package: &PackageId) -> CargoResult<Package> {
+        let hash = try!(self.index.hash(package));
         let path = try!(self.ops.download(package, &hash));
         let path = try!(self.unpack_package(package, &path).chain_error(|| {
             internal(format!("failed to unpack package `{}`", package))
         }));
         let mut src = PathSource::new(&path, &self.source_id, self.config);
         try!(src.update());
-        src.download(package, config)
+        src.download(package)
     }
 
     fn fingerprint(&self, pkg: &Package) -> CargoResult<String> {
index ad94d101cb8077d9f8aedfccc774444dd620a18c..7fb95bdf6c87ee9aca2f20c980bcc58ac8ad4da6 100644 (file)
@@ -1,5 +1,5 @@
 use core::{Source, Registry, PackageId, Package, Dependency, Summary, SourceId};
-use util::{CargoResult, ChainError, human, Config};
+use util::{CargoResult, ChainError, human};
 
 pub struct ReplacedSource<'cfg> {
     to_replace: SourceId,
@@ -20,9 +20,9 @@ impl<'cfg> ReplacedSource<'cfg> {
 }
 
 impl<'cfg> Registry for ReplacedSource<'cfg> {
-    fn query(&mut self, dep: &Dependency, config: &Config) -> CargoResult<Vec<Summary>> {
+    fn query(&mut self, dep: &Dependency) -> CargoResult<Vec<Summary>> {
         let dep = dep.clone().map_source(&self.to_replace, &self.replace_with);
-        let ret = try!(self.inner.query(&dep, config).chain_error(|| {
+        let ret = try!(self.inner.query(&dep).chain_error(|| {
             human(format!("failed to query replaced source `{}`",
                           self.to_replace))
         }));
@@ -40,9 +40,9 @@ impl<'cfg> Source for ReplacedSource<'cfg> {
         })
     }
 
-    fn download(&mut self, id: &PackageId, config: &Config) -> CargoResult<Package> {
+    fn download(&mut self, id: &PackageId) -> CargoResult<Package> {
         let id = id.with_source_id(&self.replace_with);
-        let pkg = try!(self.inner.download(&id, config).chain_error(|| {
+        let pkg = try!(self.inner.download(&id).chain_error(|| {
             human(format!("failed to download replaced source `{}`",
                           self.to_replace))
         }));
index 8ed295e91a8f1e659fffd98257cf7ef674803328..56ae25c62627d092ca3c5a4502c227be846798bd 100644 (file)
@@ -16,13 +16,11 @@ use cargo::core::resolver::{self, Method};
 fn resolve<R: Registry>(pkg: PackageId, deps: Vec<Dependency>,
                         registry: &mut R)
                         -> CargoResult<Vec<PackageId>> {
-    let config = Config::default().unwrap();
     let summary = Summary::new(pkg.clone(), deps, HashMap::new()).unwrap();
     let method = Method::Everything;
     Ok(try!(resolver::resolve(&[(summary, method)],
                               &[],
-                              registry,
-                              &config)).iter().map(|p| {
+                              registry)).iter().map(|p| {
         p.clone()
     }).collect())
 }